﻿package mortal.game.view.rebate.openNewSerSevenDay.items
{
    import Message.Public.*;
    import com.mui.controls.*;
    import extend.language.*;
    import mortal.common.global.*;
    import mortal.game.cache.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.rebate.item.*;
    import mortal.game.view.rebate.rank.*;

    public class OpenNewSerSevCell0 extends GSprite
    {
        protected var _bg:GImageBitmap;
        protected var _title:GImageBitmap;
        protected var _curFDes:GTextFiled;
        protected var _lv:GTextFiled;
        protected var _timeDes:GTextFiled;
        protected var _curFTxt:GTextFiled;
        protected var _lvTxt:GTextFiled;
        protected var _timeTxt:GTextFiled;
        protected var _list:CellsGridSprite;
        protected var _tip:GTextFiled;

        public function OpenNewSerSevCell0()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._bg = UIFactory.gImageBitmap(ImagesConst.OpenNewSerSevCellBg0, 0, 0, this);
            this._title = UIFactory.gImageBitmap(ImagesConst.OpenNewSerSevCell99_0, 59, 8, this);
            this._curFDes = UIFactory.gTextField("" + Language.getString(71797), 83, 39, 100, 20, this, GlobalStyle.textFormatHuang2);
            this._lv = UIFactory.gTextField("" + Language.getString(71798), 83, 61, 100, 20, this, GlobalStyle.textFormatHuang2);
            this._timeDes = UIFactory.gTextField("" + Language.getString(71799), 83, 81, 100, 20, this, GlobalStyle.textFormatHuang2);
            this._curFTxt = UIFactory.gTextField("", 150, 40, 100, 20, this, GlobalStyle.textFormatHuang2);
            this._lvTxt = UIFactory.gTextField("", 149, 62, 100, 20, this, GlobalStyle.textFormatZi);
            this._timeTxt = UIFactory.gTextField("", 149, 81, 100, 20, this, GlobalStyle.textFormatLv);
            this._list = UIFactory.getUICompoment(CellsGridSprite);
            this._list.colNum = 4;
            this._list.vCellWid = 75;
            this._list.hCellWid = 100;
            this._list.genCellFun = this.genItem;
            this._list.genCells(4);
            this._list.x = 22;
            this._list.y = 111;
            this.addChild(this._list);
            this._tip = UIFactory.gTextField("" + Language.getString(71800), 0, 199, 338, 20, this, GlobalStyle.textFormatLv.center());
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._bg = null;
            this._title = null;
            this._curFDes = null;
            this._lv = null;
            this._timeDes = null;
            this._curFTxt = null;
            this._lvTxt = null;
            this._timeTxt = null;
            this._list = null;
            this._tip = null;
            super.disposeImpl(param1);
            return;
        }// end function

        private function genItem() : RebateItem
        {
            var _loc_1:* = UIFactory.getUICompoment(RebateItem);
            return _loc_1;
        }// end function

        public function updateRole(param1:SToplist, param2:int) : void
        {
            param2 = RebateRankPanel.dayNumOut;
            this._title.imgUrl = "OpenNewSerSevCell" + param2 + "_" + 0;
            if (param1)
            {
                this.updateLv(param1, param2);
            }
            return;
        }// end function

        public function init(param1:int) : void
        {
            param1 = RebateRankPanel.dayNumOut;
            this._title.imgUrl = "OpenNewSerSevCell" + param1 + "_" + 0;
            this._curFTxt.text = "" + Language.getString(71801);
            this._lv.text = "" + Cache.instance.openServerSevenDay.nameStrObj[param1] + "" + Language.getString(71802);
            this._lvTxt.text = "" + Language.getString(71801);
            this._timeTxt.text = "" + Language.getString(71801);
            return;
        }// end function

        private function updateLv(param1:SToplist, param2:int) : void
        {
            var _loc_3:String = "";
            this._lv.text = "" + Cache.instance.openServerSevenDay.nameStrObj[param2] + "" + Language.getString(71802);
            switch(param1.toplistType)
            {
                case EToplistType._EToplistTypePlayerCombat:
                {
                    this._curFTxt.text = "" + param1.entityName;
                    this._lv.text = "" + Language.getString(71803);
                    this._lvTxt.text = "" + param1.valueOne + "";
                    break;
                }
                case EToplistType._EToplistTypePlayerLevel:
                {
                    this._curFTxt.text = "" + param1.entityName;
                    this._lv.text = "" + Language.getString(71804);
                    this._lvTxt.text = "" + param1.valueOne + "" + Language.getString(71805);
                    break;
                }
                case EToplistType._EToplistTypeMountRank:
                {
                    _loc_3 = "" + param1.entityName;
                    this._curFTxt.text = "" + param1.ownerName + "";
                    this._lvTxt.text = "" + param1.valueOne + Language.getString(71806) + _loc_3;
                    break;
                }
                case EToplistType._EToplistTypeWing:
                {
                    _loc_3 = "" + param1.entityName;
                    this._curFTxt.text = "" + param1.ownerName + "";
                    this._lvTxt.text = "" + param1.valueOne + Language.getString(71806) + _loc_3;
                    break;
                }
                case EToplistType._EToplistTypeFashion:
                {
                    _loc_3 = "" + param1.entityName;
                    this._curFTxt.text = "" + param1.ownerName + "";
                    this._lvTxt.text = "" + param1.valueOne + Language.getString(71806) + _loc_3;
                    break;
                }
                case EToplistType._EToplistTypeWeapon:
                {
                    _loc_3 = "" + param1.entityName;
                    this._curFTxt.text = "" + param1.ownerName + "";
                    this._lvTxt.text = "" + param1.valueOne + Language.getString(71806) + _loc_3;
                    break;
                }
                case EToplistType._EToplistTypePetGrowth:
                {
                    _loc_3 = "" + param1.entityName;
                    this._curFTxt.text = "" + param1.ownerName + "";
                    this._lvTxt.text = "" + param1.valueOne + "阶·" + _loc_3;
                    break;
                }
                case EToplistType._EToplistTypeFightSoul:
                {
                    _loc_3 = "" + param1.entityName;
                    this._curFTxt.text = "" + param1.ownerName + "";
                    this._lvTxt.text = "" + param1.valueOne + Language.getString(71806) + _loc_3;
                    break;
                }
                case EToplistType._EToplistTypeFightMethod:
                {
                    _loc_3 = "" + param1.entityName;
                    this._curFTxt.text = "" + param1.ownerName + "";
                    this._lvTxt.text = "" + param1.valueOne + Language.getString(71806) + _loc_3;
                    break;
                }
                default:
                {
                    break;
                }
            }
            this._timeTxt.text = Language.getStringByParam(71807, (param1.createDt.month + 1), param1.createDt.date, param1.createDt.hours, param1.createDt.minutes);
            return;
        }// end function

        public function updateRw(param1:int, param2:Array) : void
        {
            var _loc_4:RebateItem = null;
            var _loc_5:SPlayerItem = null;
            var _loc_3:int = 0;
            while (_loc_3 < param2.length)
            {
                
                _loc_4 = this._list.cellArr[_loc_3];
                _loc_5 = param2[_loc_3];
                if (_loc_4)
                {
                    _loc_4.updateInfo(_loc_5);
                }
                _loc_3++;
            }
            return;
        }// end function

    }
}
